﻿using Autofac.Core;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection.PortableExecutable;
using System.Threading.Tasks;
using VOL.Core.Controllers.Basic;
using VOL.Core.Filters;
using VOL.Core.ObjectActionValidator;
using VOL.Core.Services;
using VOL.Entity.DomainModels;
using VOL.System.IRepositories;
using VOL.System.IServices;

using VOL.Core.Enums;
using VOL.Core.Utilities;
using Org.BouncyCastle.Crypto.IO;
using VOL.WebApi.Controllers.WorkOrder;
using NPOI.HPSF;
using NPOI.HSSF.Util;
using VOL.Core.Configuration;
using Microsoft.Extensions.Caching.Memory;
using System.Net;
using VOL.Core.BaseProvider;
using VOL.Core.Extensions;
using VOL.Core.ManageUser;
using VOL.Core.CacheManager;
using VOL.System.Services;
using VOL.Entity.VM;
using Microsoft.Extensions.Configuration;
using NPOI.HSSF.UserModel;
using AutoMapper;
using EasyNetQ.Internals;
using Newtonsoft.Json.Linq;
using S7.Net;
using VOL.WebApi.Extensions;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
using Tea;
using AlibabaCloud.SDK.Dysmsapi20170525.Models;
using NPOI.HSSF.Record;
using VOL.Core.BaseInterface;
using System.Net.Mail;
using Org.BouncyCastle.Crypto.Engines;
using System.Data.Common;
using System.Diagnostics;
using System.IO;


using System.Diagnostics;
using TDengine.Driver;
using TDengine.Driver.Client;
using Confluent.Kafka;
using FluentFTP.Helpers;
using System.Numerics;

namespace VOL.WebApi.Controllers
{
  
    /// <summary>
    /// 邮件发送，短信发送，日志记录
    /// </summary>
    public partial class A_UpperComputerController :
    //ApiBaseController<Iupper_work_orderService>
    ApiBaseController<ISys_UserService>
    {
        A_UpperComputerController()
        {
            string s= "s";
        }

        #region by guoyuguo 2024.1.21 推棒
        /// <summary>
        /// 推棒  192.168.1.3执行
        /// </summary>
        /// <returns></returns>
        [HttpPost, Route("PushCart")]
        public async Task<IActionResult> PushCart()
        {
            var rs = new WebResponseContent();
            var isConnectUpdate1 = userService.IsIpConnect("192.168.1.3");
            if (isConnectUpdate1 == false)
            {
                rs.Message = $"192.168.1.3连接不上 不会执行！";
                rs.Status = false;
                return Json(rs);
            }
            rs = await userService.PushCart();
            return Json(rs);
        }
        #endregion
        #region by guoyuguo 2024.12.30 发送邮件
        /// <summary>
        /// 邮件 只允许192.168.110.1网段执行
        /// </summary>
        /// <param name="email"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        [HttpPost, Route("SendEmail")]
        public async Task<IActionResult> SendEmail()
        {
            var rs = new WebResponseContent();
            var isConnectUpdate1 = userService.IsIpConnect("192.168.1.160");
            if (isConnectUpdate1 == true)
            {
                rs.Message = $"192.168.1.160 不会执行！";
                rs.Status = false;
                return Json(rs);
            }
            rs = await userService.SendEmail();
            return Json(rs);
        }
        #endregion
    }



}
